

/**
 * 上网套餐类
 */
public class InternetPackage  extends AbstractPackage implements InternetService{
    //上网套餐类 特征：上网流量、每月资费 行为：显示所有套餐信息
    private int internetTraffic;

    public void show() {
        System.out.println("我的上网套餐是:每月上网流量" + internetTraffic + "M, 每月资费" + monthlyCharges + "元");
    }

    @Override
    /**
     * 统计每月资费, 假设流量1M的费用是0.3元
     */
    public double calMonthlyCharges() {
        return internetTraffic * 0.3;
    }

    public InternetPackage() {
    }

    public InternetPackage(int internetTraffic, double monthlyCharges) {
        super(monthlyCharges);
        setInternetTraffic(internetTraffic);
    }

    public int getInternetTraffic() {
        return internetTraffic;
    }

    public void setInternetTraffic(int internetTraffic) {
        this.internetTraffic = internetTraffic;
    }

    @Override
    public void serviceInternet(int internetTraffic, PhoneCardType phoneCardType) {
        System.out.println(
                "您的手机卡类型是" + phoneCardType.getCardType() + ", 您的上网流量剩余" + internetTraffic + "M," +
                "请开始浏览您喜欢的内容吧!"
        );
    }
}
